let mongoose = require('mongoose');
var Schema = mongoose.Schema;
var ObjectId = Schema.Types.ObjectId;

let GoodsScheme = new Schema({
    name: String,
    type: Number,  // 0丢失，1拾取
    // status: {type: ObjectId, ref: 'GoodsStatus'},
    address: String,  
    images: [],
    userId: {
        type: ObjectId,
        ref: 'User'
    },
    createTime: {
        type: Date,
        default: Date.now()
    },
})

// //存储前都要调用一下这个方法
// GoodsScheme.pre('save', function(next){
//     this.createTime = Date.now();
//     next();
// })


module.exports = GoodsScheme